package com.zyh.scs.admin.api.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.javers.core.metamodel.annotation.DiffInclude;
import org.javers.core.metamodel.annotation.PropertyName;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author hwh
 * @ClassName: 用户权限表$
 * @Description: $
 * @Date $
 * @Version 1.0
 */
@Data
@Schema(description = "用户权限表")
@TableName("scsx_authority")
public class UserAuthority implements Serializable {

    @Schema(description = "主键id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "角色id")
    @TableField("role_id")
    private Long roleId;

    @Schema(description = "用户id")
    @TableField("user_id")
    private Long userId;

    @Schema(description = "guid")
    @TableField("guid")
    private String guid;

    /**
     * 用户名
     */
    @Schema(description = "用户名")
    @TableField("username")
    private String username;

    /**
     * 手机号
     */
    @DiffInclude
    @PropertyName("手机号")
    @Schema(description = "手机号")
    @Length(min = 11, max = 11, message = "手机号必须为11位")
    private String phone;

    /**
     * 所属公司id
     */
    @Schema(description = "所属公司id")
    @TableField("company_id")
    private Long companyId;

    /**
     * 部门ID
     */
    @Schema(description = "用户所属部门id")
    @TableField("dept_id")
    private Long deptId;
    @Schema(description = "第三方用户所属部门id")
    @TableField("third_dept_id")
    private String thirdDeptId;

    /**
     * 岗位id
     */
    @Schema(description = "岗位id")
    @TableField("post_id")
    private Long postId;

    @Schema(description = "状态 0为开启  9为关闭")
    @TableField("status")
    private String status;

    /**
     * 0-正常，1-删除
     */
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "删除标记,1:已删除,0:正常")
    private String delFlag;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

}
